package com.zs.zcerp.entrance.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zs.zcerp.entrance.entity.Post;
import com.zs.zcerp.entrance.mapper.PostMapper;
import com.zs.zcerp.entrance.service.IPostService;
import org.springframework.stereotype.Service;

import java.util.Calendar;
import java.util.List;

@DS("oracle")
@Service
public class PostServiceImpl extends ServiceImpl<PostMapper, Post> implements IPostService {


    @Override
    public List<Post> listPosts() {
        return baseMapper.selectList(new QueryWrapper<Post>().eq("RULE_NO", "8114"));
    }

    @Override
    public List<Post> listPostsLately() {
        Calendar c = Calendar.getInstance();
        c.add(Calendar.DATE, -1);
        return baseMapper.selectList(new QueryWrapper<Post>().eq("RULE_NO", "8114").gt("LAST_DATE", c.getTime()));
    }
}
